; Crappy SNDH-player
;
; main.s
;
; June 9, 2003
;
; Anders Eriksson
; ae@dhs.nu

		comment HEAD=%111	
		output .ttp
		opt	p=68000,NOCASE

ttpfile:	equ	1					;0=use fixed filename 1=commandline
maxheadsize:	equ	1000

		section	text

begin:		include	'init.s'				;release memory check dsp etc
		include	'loader.s'				;load file
		include	'parse.s'
		
		move.l	#init_sndh,d0
		bsr.w	dosupexec

		move.l	#front_text,d0				;print text
		bsr.w	print					;

		move.l	filename,d0				;print filename
		bsr.w	print					;

		move.l	#new_row,d0				;print new row
		bsr.w	print					;

		move.l	#channels_text,d0			;print channels
		bsr.w	print

		;-----------------------------------------------
		move.l	#songname_text,d0			;print songname title
		bsr.w	print

		move.l	songname,d0				;print songname
		bsr.w	print					;

		move.l	#new_row,d0				;print new row
		bsr.w	print					;

		;-----------------------------------------------
		move.l	#composer_text,d0			;print composer text
		bsr.w	print

		move.l	composer,d0				;print composer
		bsr.w	print					;

		move.l	#new_row,d0				;print new row
		bsr.w	print					;

		;-----------------------------------------------
		move.l	#ripper_text,d0				;print ripper title
		bsr.w	print

		move.l	ripper,d0				;print ripper
		bsr.w	print					;

		move.l	#new_row,d0				;print new row
		bsr.w	print					;


		;-----------------------------------------------
		move.l	#converter_text,d0			;print converter title
		bsr.w	print

		move.l	converter,d0				;print converter
		bsr.w	print					;

		move.l	#new_row,d0				;print new row
		bsr.w	print					;


		;-----------------------------------------------
		move.l	#timer_text,d0				;print timer title
		bsr.w	print

		move.l	timerspeed,d0				;print timer
		bsr.w	print					;

		move.l	#hertz,d0				;print new hertz
		bsr.w	print					;


		;-----------------------------------------------
		move.l	#key_text,d0				;print pres any key
		bsr.w	print					;

		move.w	#7,-(sp)				;crawcin()
		trap	#1					;
		addq.l	#2,sp					;

		move.l	#exit_sndh,d0
		bsr.w	dosupexec

		include	'exit.s'				;exit program


print:		move.l	d0,-(sp)				;textprint
		move.w	#9,-(sp)				;
		trap	#1					;
		addq.l	#6,sp					;
		rts

dosupexec:	move.l	d0,-(sp)				;supexec()
		move.w	#$26,-(sp)				;
		trap	#14					;
		addq.l	#6,sp					;
		rts						;

		include	'sndh.s'				;SNDH playing crap
		include	'ice_unp2.s'				;ICE! decruncher


		section	data


	ifeq	ttpfile

testname:	dc.b	'song.snd',0
		even

	endc


front_text:	dc.b	'Krap SNDH Player v1.4 (June 9, 2003)',13,10
		dc.b	'------------------------------------',13,10,13,10
		dc.b	'  Filename: ',0
		even

channels_text:	dc.b	'  Channels: 3',13,10,0
		even

songname_text:	dc.b	'  Songname: ',0
		even

composer_text:	dc.b	'  Composer: ',0
		even

ripper_text:	dc.b	'    Ripper: ',0
		even

timer_text:	dc.b	'Timer Freq: ',0
		even

converter_text:	dc.b	' Converter: ',0
		even

hertz:		dc.b	' Hertz',13,10,0
		even
		
key_text:	dc.b	13,10,'Press any key to stop playing.',13,10,0
		even

new_row:	dc.b	13,10,0
		even

dummy:		dc.b	0
		even
				
error_text:	dc.l	dummy
songname:	dc.l	dummy
composer:	dc.l	dummy
ripper:		dc.l	dummy
timerspeed:	dc.l	dummy
converter:	dc.l	dummy
		even

		section	bss

icecheck:	ds.l	1
filelength:	ds.l	1					;length in bytes of loaded file
filename:	ds.l	1					;address to filename to load
file_error:	ds.l	1					;error check
filenumber:	ds.w	1					;filenumber
filebuffer:	ds.l	1					;address to loader dest buffer
reservelength:	ds.l	1					;bytes to reserve
save_c:		ds.l	1					;old timer-c
save_dta:	ds.l	1					;old dta address
dta:		ds.l	11					;new dta buffer

		end